home *** CD-ROM | disk | FTP | other *** search
/ IRIX Patches 1995 March / SGI IRIX Patches 1995 Mar.iso / 5.3_patches / patchSG0000159 / patchSG0000159.idb / usr / include / sys / wd95a_struct.h.z / wd95a_struct.h
Encoding:
C/C++ Source or Header  |  1995-03-10  |  6.0 KB  |  179 lines

  1. /**************************************************************************
  2.  *                                                                        *
  3.  *               Copyright (C) 1992, Silicon Graphics, Inc.               *
  4.  *                                                                        *
  5.  *  These coded instructions, statements, and computer programs  contain  *
  6.  *  unpublished  proprietary  information of Silicon Graphics, Inc., and  *
  7.  *  are protected by Federal copyright law.  They  may  not be disclosed  *
  8.  *  to  third  parties  or copied or duplicated in any form, in whole or  *
  9.  *  in part, without the prior written consent of Silicon Graphics, Inc.  *
  10.  *                                                                        *
  11.  **************************************************************************/
  12.  
  13. /*
  14.  * wd95a_struct.h -- Western Digital 95a driver data structures.
  15.  */
  16.  
  17. #ident "$Revision: 1.21 $"
  18.  
  19. #ifndef _SYS_WD95A_STRUCT
  20. #define _SYS_WD95A_STRUCT
  21.  
  22. /* definitions for numbers of things */
  23. #if !defined(EVEREST)
  24. #define WD95_CTLRS    8        /* max # of controllers */
  25. #endif
  26. #define    WD95_QDEPTH    1        /* number of outstanding que'd */
  27.  
  28. #ifdef SCSI_3
  29. #define WD95_LUPC    16        /* logical units per controller */
  30. #else
  31. #define WD95_LUPC    8        /* logical units per controller */
  32. #endif
  33.  
  34. /* defines for scsirequest.sr_ha_flags */
  35. #define WFLAG_ODDBYTEFIX    1
  36.  
  37. /*
  38.  * WD95a driver equivalent of scsirequest -- once a slot is
  39.  * free, a wd95request gets matched with a scsirequest.
  40.  */
  41. struct wd95request {
  42.     u_char            active : 1,
  43.                 starting : 1,
  44.                 ctq : 1;
  45.     u_char            ctlr;
  46.     u_char            unit;
  47.     u_char            lun;
  48.     u_char            cmd_tag;    /* command tag */
  49.     u_char            reset_num;    /* reset number when timeout started */
  50.     u_char            flags;
  51.     int            timeout_id;
  52.     int            resid;
  53.     int            save_resid;
  54.     int            tlen;        /* length of this transfer */
  55.     struct scsi_request    *sreq;
  56.     struct wd95request    *next;
  57. };
  58. typedef struct wd95request wd95request_t;
  59.  
  60. /* per logical unit (lun) information structure */
  61. struct wd95luninfo {
  62.     u_char    lun_num;    /* lun number for this device */
  63.     u_char    sense:1,    /* request sense in progress */
  64.         excl_act:1,    /* exclusive access active */
  65.         ctq_en:1,    /* cmd tag queueing available */
  66.         ctq_drop_err:1;    /* drop queued commands on err */
  67.     u_char    ctqs_in_prog;    /* count of command tags in progress */
  68.     uint    refcnt;
  69.     scsi_request_t    *u_sense_req;    /* scsi request for sense info */
  70.     wd95request_t *wqueued; /* queue of active for this device */
  71.     wd95request_t *wcurrent; /* current active wreq for this device */
  72.  
  73.     scsi_request_t *reqhead; /* queue commands here normally */
  74.     scsi_request_t *reqtail;
  75.  
  76.     struct scsi_target_info    tinfo;
  77. };
  78. typedef struct wd95luninfo wd95luninfo_t;
  79.  
  80. /* per unit (device) information structure */
  81. struct wd95unitinfo {
  82.     u_char    number;        /* unit number of this unit (0-13) */
  83.     u_char    wreq_cnt;    /* count of total wreqs for this target */
  84.     ushort    sense:1,    /* request sense in progress */
  85.         active:1,    /* unit is currently active */
  86.         u_ca:1,        /* contingent allegiance occurred */
  87.         abortqueue:1,    /* work queues aborted */
  88.         aenreq:1,    /* need AEN acknowledge */
  89.         tostart:1,    /* start timeout running */
  90.         disc:1,        /* disconnect enabled */
  91.         sync_en:1,    /* sync is OR should be enabled */
  92.         sync_req:1,    /* sync negotiation needed */
  93.         wide_en:1,    /* wide is OR should be enabled */
  94.         wide_req:1,    /* wide negotiation needed */
  95.         ext_msg:1,    /* extended message in progress */
  96.         present:1;    /* unit responds to selection */
  97.     u_char    sync_off;    /* negotiated sync offset */
  98.     u_char    sync_per;    /* required sync period */
  99.     u_char    sel_tar;    /* location for selection */
  100.     u_char    lun_round;    /* round robin queue lun checking */
  101.     u_char    cur_lun;    /* current lun under service */
  102.     u_char    cur_tag;    /* current tag number for assignment */
  103.  
  104.     scsi_request_t *auxhead; /* queue commands here when u_ca set */
  105.     scsi_request_t *auxtail;
  106.  
  107.     wd95request_t *wrfree; /* pointer to free wd95request structs */
  108.     wd95request_t wreq[WD95_QDEPTH];
  109.  
  110.     wd95luninfo_t    *lun_info[SCSI_MAXLU];
  111.     wd95luninfo_t    lun_0;
  112.  
  113.     void    (*sense_callback)(char *);
  114.  
  115.     struct wd95ctlrinfo *ctrl_info;
  116.  
  117.     sema_t    opensem;
  118.  
  119. #if WD95_CMDHIST
  120.     char prevcmd[16][12];
  121.     int prevcmd_rotor;
  122. #endif
  123. };
  124. typedef struct wd95unitinfo wd95unitinfo_t;
  125.  
  126. struct wd95ctlrinfo {
  127.     lock_t    lock;
  128.     lock_t    qlock;        /* Lock for structure queues */
  129.     lock_t    auxlock;
  130.  
  131.     u_char    number;        /* number of this controller */
  132.     u_char    ci_idmsgin;    /* resel & looks like id msg in */
  133.     u_char    host_id;    /* host id of this controller */
  134.     u_char    round_robin;    /* last unit number that was checked */
  135.     u_char    max_round;    /* unit to wrap at */
  136.     u_char    cur_target;    /* current target id */
  137.     u_char    reset_num;    /* current reset number */
  138.     u_char    sync_period;    /* synchronous period for this controller */
  139.     u_char    sync_offset;    /* and offset for this controller */
  140.     u_char    revision;    /* revision of chip */
  141.  
  142.     ushort    present:1,    /* flag indicating if ctlr is installed */
  143.         reset:1,    /* set if resetting scsi busses */
  144.         pagebusy:1,    /* odd-byte fixup buffer use status */
  145.         active:1,    /* controller is currently active */
  146.         intr:1,        /* currently processing intr on this ctlr */
  147.         narrow:1,    /* this is a narrow bus (limited by hw) */
  148.         diff:1;        /* clear if single ended, set if differential */
  149.  
  150.     u_char    *page;        /* odd-byte fixup buffer */
  151.     ushort    *wdi_log;    /* log all accesses to wd95 */
  152.  
  153.     sema_t    d_sleepsem;    /* Synchronous request waiting sem */
  154.     sema_t    d_onlysem;    /* 'only' request waiting sem */
  155.     short    d_sleepcount;    /* Synchronous request waiter count */
  156.     short    d_onlycount;    /* Synchronous request waiter count */
  157.  
  158.     scsi_request_t *acthead; /* queue commands here while active */
  159.     scsi_request_t *acttail;
  160.  
  161.     caddr_t    ha_addr;    /* address of the associated wd95a chip */
  162.  
  163.     dmamap_t *d_map;
  164.     struct wd95unitinfo *unit[WD95_LUPC]; /* unit info */
  165. };
  166. typedef struct wd95ctlrinfo wd95ctlrinfo_t;
  167.  
  168. /* flags for each bus */
  169. #define    WD95BUS_SYNC    0x01        /* Synchronous enable */
  170. #define    WD95BUS_DISC    0x02        /* Disconnect/reconnect enable */
  171. #define    WD95BUS_WIDE    0x04        /* Wide enable */
  172. #define    WD95BUS_CTQ    0x10        /* cmd tag queueing enable */
  173.  
  174. extern u_char wd95_bus_flags[];
  175.  
  176. extern u_char wd95_syncperiod[];
  177.  
  178. #endif /* _SYS_WD95A_ */
  179.